package baseClass;
import CalcClass.CalcLexer;
/*
    token流中的Token节点
    2022-3-9-杨海南
 */
public class BaseToken {
    private int index;
    //这个词法属性的字符串
    private String token;
    //该token的符号类型下标
    private int type;
    private int start;
    private int end;

    public BaseToken(int index, String token, int type, int start, int end) {
        this.index = index;
        this.token = token;
        this.type = type;
        this.start = start;
        this.end = end;
    }

    @Override
    public String toString() {
        return "BaseToken{"+this.token+':'+ CalcLexer.ruleNames[this.type - 1]+"!!"+start+"->"+end+'}';
    }

    public int getIndex() {
        return index;
    }

    public String getToken() {
        return token;
    }

    public int getType() {
        return type;
    }

    public int getStart() {
        return start;
    }

    public int getEnd() {
        return end;
    }
}
